<fieldset>
	<legend>Stage editor</legend>
	<?php if(!isset($action)) $action = 'processdesigner/create_stage'; ?>
        <?php echo form_open($action); ?>
		<fieldset>
			<legend>Stage information</legend>

			<ul>
				<li><p>
                                        <?php echo form_error('name'); ?>
					<label for="name">Stage name:</label><br />
					<input type="text" name="name" id="name" value="<?php echo $name; ?>" />
				</p></li>


				<li><p>
                                        <?php echo form_error('description'); ?>
					<label for="description">Stage description:</label><br />
                                        <textarea rows="10" cols="80" name="description" id="description"><?php echo $description; ?></textarea>
				</p></li>
			</ul>
		</fieldset>

		<fieldset>
			<legend>Linkage information</legend>

			<ul>
				<li>
					<p>Previous stage(s):</p>
					<?php echo $stages_table; ?>
				</li>

				<li><p>
                                        <?php echo form_error('jointype'); ?>
					<label for="jointype">Join type: (for incoming links; not needed when there are less than 2 previous stages)</label><br />
					<select name="jointype" id="jointype">
						<option value="NONE">--- (no or 1 previous stage)</option>
						<option value="AND">AND</option>
						<option value="OR">OR</option>
					</select>
				</p></li><br />

				<li><p>
                                        <?php echo form_error('splittype'); ?>
					<label for="splittype">Split type: (for outgoing links; not needed when there are less than 2 next stages)</label><br />
					<select name="splittype" id="splittype">
						<option value="NONE">--- (no or 1 next stage)</option>
						<option value="AND">AND</option>
						<option value="OR">OR</option>
					</select>
				</p></li>
			</ul>
		</fieldset>


		<fieldset>
			<legend>Participants information</legend>
			<ul>
				<li>
					<p>Stage participants:</p>
					<?php echo $users_table; ?>
				</li>

				<li>
                                        <?php echo form_error('administrator'); ?>
					<p><label for="administrator">Stage administrator: (this user will be a stage participant automaticly)</label></p>

					<?php echo $users_select; ?>
				</li>
			</ul>

		</fieldset>

		<p>
			<input type="submit" value="Save" />
                        <?php if(!isset($location)) $location = 'home/main'; ?>
			<input type="button" value="Cancel" onclick="javascript:document.location = '<?php echo site_url($location); ?>'" />
		</p>
    <?php echo form_close() ?>
</fieldset>

